﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AL.Doodled
{
    internal class WidgetStyleRegister
    {
        #region fields
        private Dictionary<string, Style> styleNameRegister;
        private Dictionary<string, Style> styleClassRegister;
        #endregion

        #region initialization
        public WidgetStyleRegister()
        {
            styleNameRegister = new Dictionary<string, Style>();
            styleClassRegister = new Dictionary<string, Style>();
        }
        #endregion

        #region methods
        /// <summary>
        /// Evaluate if the passed name is registered.
        /// </summary>
        /// <param name="name">The name.</param>
        /// <returns>Is the name registered?</returns>
        public bool IsNameRegistered(string name)
        {
            return styleNameRegister.ContainsKey(name);
        }

        /// <summary>
        /// Evaluate if the passed class is registered.
        /// </summary>
        /// <param name="name">The class.</param>
        /// <returns>Is the class registered?</returns>
        public bool IsClassRegistered(string name)
        {
            return styleClassRegister.ContainsKey(name);
        }

        /// <summary>
        /// Get the style linked to the passed class.
        /// </summary>
        /// <param name="name">The class name.</param>
        /// <returns>The style linked to the class.</returns>
        public Style GetStyleByClass(string name)
        {
            return styleClassRegister[name];
        }

        /// <summary>
        /// Get the style linked to the passed name.
        /// </summary>
        /// <param name="name">The name.</param>
        /// <returns>The style linked ot the name.</returns>
        public Style GetStyleByName(string name)
        {
            return styleNameRegister[name];
        }
        #endregion
    }
}
